package cn.iocoder.yudao.module.biz.dal.mysql.customer.contact;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.customer.contact.CustomerArchiveContactDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.customer.contact.vo.*;

/**
 * 客户档案-其他联系人 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface CustomerArchiveContactMapper extends BaseMapperX<CustomerArchiveContactDO> {

    default PageResult<CustomerArchiveContactDO> selectPage(CustomerArchiveContactPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerArchiveContactDO>()
                .eqIfPresent(CustomerArchiveContactDO::getCustomerArchiveId, reqVO.getCustomerArchiveId())
                .likeIfPresent(CustomerArchiveContactDO::getCustomerArchiveName, reqVO.getCustomerArchiveName())
                .likeIfPresent(CustomerArchiveContactDO::getName, reqVO.getName())
                .eqIfPresent(CustomerArchiveContactDO::getType, reqVO.getType())
                .eqIfPresent(CustomerArchiveContactDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(CustomerArchiveContactDO::getEmail, reqVO.getEmail())
                .eqIfPresent(CustomerArchiveContactDO::getWechat, reqVO.getWechat())
                .eqIfPresent(CustomerArchiveContactDO::getDescribe, reqVO.getDescribe())
                .betweenIfPresent(CustomerArchiveContactDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CustomerArchiveContactDO::getOnwerUserId, reqVO.getOnwerUserId())
                .orderByDesc(CustomerArchiveContactDO::getId));
    }

}